package core.resources
{
import core.model.GameModel;
import core.service.Service;
import core.service.ServiceRequest;

/**
 * PlayerDataResourceTask
 * @author jliang
 *
 */
public class PlayerDataResourceTask extends LoadTaskBase
{
    //==========================================================================
    //  Constructor
    //==========================================================================
    public function PlayerDataResourceTask()
    {
        super();
    }
    
    override public function start():void
    {
        var request1:ServiceRequest = new ServiceRequest("player_inventory", null, onPlayerInventoryReadyHandler);
        
        var request2:ServiceRequest = new ServiceRequest("player_info", null, onPlayerInfoReadyHandler);
        
        
        Service.invoke(request1, request2;
    }
    
    private function onPlayerInventoryReadyHandler(data:Object):void
    {
        GameModel.instance.playerModel.initPlayerInventory(data);
    }
    
    private function onPlayerInfoReadyHandler(data:Object):void
    {
        GameModel.instance.playerModel.initPlayerInfo(data);
    }
    
}
}